﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Neoseeker.NAMFox.Tests
{
    public class MenuItem
    {
        private string chromeId;

        public MenuItem(string chromeId)
        {
            this.chromeId = chromeId;
        }

        public string Command
        {
            get { return TestBase.Selenium.Processor.GetString("getToolbarMenuItemCommand", new string[] { chromeId }); }
        }

        public bool Visible
        {
            get { return TestBase.Selenium.Processor.GetBoolean("getToolbarMenuItemVisibility", new string[] { chromeId }); }
        }

        public void Execute()
        {
            TestBase.Selenium.Processor.DoCommand("executeToolbarMenuItemCommand", new string[] { chromeId });
        }

        public void Click()
        {
            this.Click(MouseButtons.Left);
        }

        public void MiddleClick()
        {
            this.Click(MouseButtons.Middle);
        }

        private void Click(MouseButtons button)
        {
            TestBase.Selenium.Processor.DoCommand("clickToolbarMenuItem", new string[] { chromeId, button.ToString() });
        }
    }
}
